#include<iostream>
#include<vector>


using std::cout;
using std::vector;

std::ostream& operator<<(std::ostream& oss,vector<int>vec)
{
    for(const auto &i:vec)
    {
        oss<<i<<" ";
    }
    return oss;
}



int partition(vector<int>& vec,int low,int high)
{
    int key =vec[low];
    while(low<high)
    {
        while(low<high&&vec[high]>=key)
        {
            --high;
        }
        if(low<high)
        {
            vec[low++]=vec[high];
        }
        while(low<high&&vec[low]<=key)
        {
            ++low;
        }
        if(low<high)
        {
            vec[high--]=vec[low];
        }
    }
    vec[low]=key;
    return low;
}

void sort(vector<int> & vec,int low,int high)
{
    if(low<high)
    {
        int pos = partition(vec,low,high); 
        sort(vec,low,pos-1);
        sort(vec,pos+1,high);
    }
}

void fastsort(vector<int> &vec)
{
    int left=0;
    int right=vec.size()-1;
    sort(vec,left,right);
    cout<<vec;
}

int main()
{
    vector<int> srot(100);
    for(int i=0;i<100;++i)
    {
        srot[i]=100-i;
    }
    fastsort(srot);
    cout<<srot<<"\n";
    //快速排序
}
